<?php
/**
* Base class: common interface for all types of requests.
*<p> Requests are the main interface between client and server side. They are managed by AJAX requests
* from the client side using the REQID _GET parameter. See the client-side documentation for more details.</p>
*<p>On the server side, the request entry point is the <i>request.php</i> file.</p>
*<p>On the server side, <i>request.php</i> will setup a full Engine environment then instantiate the calling
*request class (actually, the REQID is the class name), so what you get is: <code> $request = new $REQID()</code></p>
*<p>The processing place for a generic request is the <i>DoRequest()</i> method, while the 
*<i>Output()</i> method is called for retrieve the request output.</p>
*<p>In other words, this is the flow:
*<code>$request = new $REQID();
*$request->DoRequest();
*echo $request->Output();
*</code></p>
*@package Core
*@subpackage Request
*@author Willy Gardiol <willy@gardiol.org>
*@version 1.0
*/
abstract class CoreRequest
{
	private $error = false;

	public function __construct( $auth_required = false )
	{
		if ( $auth_required && !CoreAuth::Authorize() )
			throw new Exception("Sorry but authorization is required!");
	}
	/**
	* Set an error message (clear error by setting it to <i>false</i>).
	*@param string $error error string (can be boolean)
	*/
	final public function SetError( $error )
	{
		$this->error = $error;
	}
	/**
	* Return error code
	*/
	final public function GetError()
	{
		return $this->error;
	}
	/**
	* Do the requested processing
	*/
	abstract public function DoRequest();
}
?>